_require "basis.smi"
_require "vector-sig.sml"

structure Vector3 =
struct
  type 'a vec = {x: 'a, y: 'a, z: 'a}
  val dim : int
  val tabulate : (int -> 'a) -> 'a vec
  val equal : real vec * real vec -> bool
  val zerov : real vec
  val addv : real vec * real vec -> real vec
  val subv : real vec * real vec -> real vec
  val dotvp : real vec * real vec -> real
  val crossvp : real vec * real vec -> real vec
  val addvs : real vec * real -> real vec
  val mulvs : real vec * real -> real vec
  val divvs : real vec * real -> real vec
  val mapv : ('a -> 'b) -> 'a vec -> 'b vec
  val map3v : ('a * 'b * 'c -> 'd) -> 'a vec * 'b vec * 'c vec -> 'd vec
  val foldv : ('a * 'b -> 'b) -> 'a vec -> 'b -> 'b
  val format : {cvt:'a -> string, lp:string, rp:string, sep:string}
               -> 'a vec -> string
  val explode : 'a vec -> 'a list
  val implode : 'a list -> 'a vec
  type matrix = {m00 : real, m01 : real, m02 : real,
                 m10 : real, m11 : real, m12 : real,
                 m20 : real, m21 : real, m22 : real}
  val zerom : matrix
  val addm : matrix * matrix -> matrix
  val outvp : real vec * real vec -> matrix
end
